/*****************************************************************************
 *   Copyright 2005 Tim A Wang
 *
 *   Licensed under the Apache License, Version 2.0 (the "License");
 *   you may not use this file except in compliance with the License.
 *   You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 *   Unless required by applicable law or agreed to in writing, software
 *   distributed under the License is distributed on an "AS IS" BASIS,
 *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *   See the License for the specific language governing permissions and
 *   limitations under the License.
 *
 ****************************************************************************/
package com.jb.web.model.css;

public class FontStyle extends Style {
    private String mAlign;
    private String mColor;
    private String mDecoration;
    private String mFamily;
    private String mIndent;
    private String mShadow;
    private String mSize;
    private String mStyle;
    private String mTransform;
    private String mVariant;
    private String mWeight;
    private String vAlign;

    public void setAlign(String mTextAlign) {
        this.mAlign = mTextAlign;
    }

    public String getAlign() {
        return mAlign;
    }

    public void setColor(String mColor) {
        this.mColor = mColor;
    }

    public String getColor() {
        return mColor;
    }

    public void setFamily(String mFamily) {
        this.mFamily = mFamily;
    }

    public String getFamily() {
        return mFamily;
    }

    public void setFontStyle(String mStyle) {
        this.mStyle = mStyle;
    }

    public String getFontStyle() {
        return mStyle;
    }

    public void setSize(String mSize) {
        this.mSize = mSize;
    }

    public String getSize() {
        return mSize;
    }

    public String getStyle() {
        StringBuffer buffer = new StringBuffer("");
        buffer.append(addProperty("font-style", mStyle, null));
        buffer.append(addProperty("font-variant", mVariant, null));
        buffer.append(addProperty("font-family", mFamily, null));
        buffer.append(addProperty("font-size", mSize, null));
        buffer.append(addProperty("font-weight", mWeight, null));
        buffer.append(addProperty("color", mColor, null));
        buffer.append(addProperty("text-decoration", mDecoration, null));
        buffer.append(addProperty("text-shadow", mShadow, null));
        buffer.append(addProperty("text-transform", mTransform, null));
        buffer.append(addProperty("text-indent", mIndent, null));
        buffer.append(addProperty("text-align", mAlign, null));
        buffer.append(addProperty("vertical-align", vAlign, null));

        return buffer.toString();
    }

    public void setStyleValue(String pValue) {
        if (pValue.indexOf("font-style") != -1) {
            mStyle = pValue.substring(pValue.indexOf(":") + 1);
        }

        if (pValue.indexOf("font-style") != -1) {
            mStyle = pValue.substring(pValue.indexOf(":") + 1);
        }

        if (pValue.indexOf("font-family") != -1) {
            mFamily = pValue.substring(pValue.indexOf(":") + 1);
        }

        if (pValue.indexOf("font-variant") != -1) {
            mVariant = pValue.substring(pValue.indexOf(":") + 1);
        }

        if (pValue.indexOf("font-size") != -1) {
            mSize = pValue.substring(pValue.indexOf(":") + 1);
        }

        if (pValue.indexOf("font-weight") != -1) {
            mWeight = pValue.substring(pValue.indexOf(":") + 1);
        }

        if (pValue.indexOf("color") != -1) {
            mColor = pValue.substring(pValue.indexOf(":") + 1);
        }

        if (pValue.indexOf("text-decoration") != -1) {
            mDecoration = pValue.substring(pValue.indexOf(":") + 1);
        }

        if (pValue.indexOf("text-shadow") != -1) {
            mShadow = pValue.substring(pValue.indexOf(":") + 1);
        }

        if (pValue.indexOf("text-transform") != -1) {
            mTransform = pValue.substring(pValue.indexOf(":") + 1);
        }

        if (pValue.indexOf("text-indent") != -1) {
            mIndent = pValue.substring(pValue.indexOf(":") + 1);
        }

        if (pValue.indexOf("vertical-align") != -1) {
            vAlign = pValue.substring(pValue.indexOf(":") + 1);
        }

        if (pValue.indexOf("text-align") != -1) {
            mAlign = pValue.substring(pValue.indexOf(":") + 1);
        }
    }

    public void setVariant(String mVariant) {
        this.mVariant = mVariant;
    }

    public String getVariant() {
        return mVariant;
    }

    public void setWeight(String mWeight) {
        this.mWeight = mWeight;
    }

    public String getWeight() {
        return mWeight;
    }

    public static void main(String[] args) {
        String colorStr = "color:white;font-size:12pt;font-family:12pt;font-variant:12pt;";
        FontStyle fontStyle = new FontStyle();
        fontStyle.setStyle(colorStr);
        System.out.println(fontStyle.getStyle());
    }

    public void setDecoration(String mDecoration) {
        this.mDecoration = mDecoration;
    }

    public String getDecoration() {
        return mDecoration;
    }

    public void setIndent(String mTextIndent) {
        this.mIndent = mTextIndent;
    }

    public String getIndent() {
        return mIndent;
    }

    public void setShadow(String mShadow) {
        this.mShadow = mShadow;
    }

    public String getShadow() {
        return mShadow;
    }

    public void setTransform(String mTransform) {
        this.mTransform = mTransform;
    }

    public String getTransform() {
        return mTransform;
    }

    public void setVAlign(String vAlign) {
        this.vAlign = vAlign;
    }

    public String getVAlign() {
        return vAlign;
    }
}
